import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/Manager.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Manager',
    component: HomeView,
    redirect : '/home', //输入/，重定向到home
    //子路由
    children : [
      {
        path: 'information', //不要加斜杠/
        name: 'Information',
        component: () => import('../views/managerView/Information')
      },

      {
        path: 'input', //不要加斜杠/
        name: 'Input',
        component: () => import('../views/managerView/Input')
      },
      {
        path: 'home', //不要加斜杠/
        name: 'Home',
        component: () => import('../views/managerView/Home')
      },
      {
        path: 'statistics', //不要加斜杠/
        name: 'Statistics',
        component: () => import('../views/managerView/Statistics')
      },
      {
        path: 'maintainInfo', //不要加斜杠/
        name: 'MaintainInfo',
        component: () => import('../views/managerView/MaintainInfo')
      },

      {
        path: 'delay', //不要加斜杠/
        name: 'Delay',
        component: () => import('../views/managerView/Delay')
      },

      {
        path: 'approve', //不要加斜杠/
        name: 'Approve',
        component: () => import('../views/managerView/Approve')
      },

      {
        path: 'thirdParty', //不要加斜杠/
        name: 'ThirdParty',
        component: () => import('../views/managerView/ThirdParty')
      },

      {
        path: 'userManage', //不要加斜杠/
        name: 'UserManage',
        component: () => import('../views/managerView/UserManage')
      },

    ]

  },

  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  },

  {
    path: '/register',
    name: 'Register',
    component: () => import('../views/Register.vue')
  },


]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
